<template>
  <div>
    <detail-banner :bannerImg="bannerImg" :gallaryImgs="gallaryImgs" :sightName="sightName"></detail-banner>
    <keep-alive>
    <detail-header></detail-header>
    </keep-alive>
    <detail-list :list="categoryList"></detail-list>


    <div class="content" v-if="showContent">Content...</div>
    <div style="height:900px"></div>
  </div>
</template>

<script>
import DetailBanner from './components/Banner.vue'
import DetailHeader from './components/Header.vue'
import DetailList from './components/List.vue'


import axios from 'axios'
export default {
  name: 'Detail',
  components: {
    DetailBanner,
    DetailHeader,
    DetailList
  },
  data () {
    return {
      bannerImg: '',
      categoryList: [],
      gallaryImgs: [],
      sightName: '',
      showContent: true
    }
  },
  methods: {
    getDetailInfo () {
      axios.get('api/detail.json/?id=' + this.$route.params.id).then(res => {
        console.log(res)
        if (res.data && res.data.ret) {
          const data = res.data.data
          const bannerImg = data.bannerImg
          const categoryList = data.categoryList
          const gallaryImgs = data.gallaryImgs
          const sightName = data.sightName
          this.bannerImg = bannerImg
          this.categoryList = categoryList
          this.gallaryImgs = gallaryImgs
          this.sightName = sightName
        }
      })
    }
  },
  mounted () {
    this.getDetailInfo()
  }
}
</script>

<style  scoped lang="stylus">
.content
  width:150px
  height:150px
  background:red
  text-align:center
  line-height:150px
  font-size:20px
  margin:8px auto;

</style>
